package com.cubeofnine.sugar.business;

import java.util.Vector;

import com.cubeofnine.sugar.service.element.EntryListResult;

import android.content.Context;

public class AccountsBusiness extends BusinessImpt {

	public static final String ACCOUNTS_ORDER_BY_DEFAULT = "name, billing_address_country, billing_address_city";
	public static final String ACCOUNTS_ORDER_BY_NAME = "name";

	public static String getClassName() {
		return AccountsBusiness.class.getName();
	}

	public AccountsBusiness(Context context) throws Exception {
		super(context, MODULE_ACCOUNTS);
	}

	public EntryListResult getEntryList(String query, String orderBy,
			int offset, Vector<String> fieldName, int maxResults, int deleted)
			throws Exception {

		if (!query.trim().isEmpty()) {
			query = "LOWER(Accounts.name) LIKE '" + query + "%'";
		}

		EntryListResult contactsEntryList = super.getEntryList(query, orderBy,
				offset, fieldName, maxResults, deleted);

		return contactsEntryList;
	}

	public String createAccount(String name, String phone, String website)
			throws Exception {

		String accountId = super.createAccount(name, phone, website);

		return accountId;
	}
}
